package org.hourse.service.impl;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.hourse.entity.${entityName};
import org.hourse.repository.${entityName}Repository;
import org.hourse.service.${entityName}Service;

@Service("${entityName?uncap_first}Service")
public class ${entityName}ServiceImpl implements ${entityName}Service{
	
	@Autowired
	private ${entityName}Repository ${entityName?uncap_first}Repository;

	
	/**
	 * 
	* @Title: findById  
	* @Description: 根据id查询对象
	* @param	id
	* @return
	* @throws
	 */
	public ${entityName} findById(Long id){
		Optional<${entityName}> ${entityName?uncap_first}Optional = ${entityName?uncap_first}Repository.findById(id);
		if(${entityName?uncap_first}Optional.isPresent()) {
			return ${entityName?uncap_first}Optional.get();
		}
		return null;
	}
	
}
